package com.zmx.doctor.adapter;

import android.app.Activity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.wang.adapters.adapter.BaseAdapterRvList;
import com.wang.adapters.base.BaseViewHolder;
import com.zmx.doctor.R;
import com.zmx.doctor.pojo.RegistrationList;

import java.text.SimpleDateFormat;
import java.util.Date;

import butterknife.BindView;
import butterknife.ButterKnife;

public class RegistrationListAdapter extends BaseAdapterRvList<RegistrationListAdapter.ViewHolder, RegistrationList> {

    public RegistrationListAdapter(Activity activity) {
        super(activity);
    }

    @Override
    protected void onBindVH(ViewHolder holder, int listPosition, RegistrationList registrationList) {

        holder.name.setText(registrationList.getName());
        holder.time.setText(registrationList.getAddtime());
        Log.e("图片路径","图片路径"+registrationList.getAvatar());
        Glide.with(mActivity).load(registrationList.getAvatar()).into(holder.image);

    }

    @NonNull
    @Override
    protected ViewHolder onCreateVH(ViewGroup parent, LayoutInflater inflater) {

        RegistrationListAdapter.ViewHolder holder = new RegistrationListAdapter.ViewHolder(inflater.inflate(R.layout.adapter_registration_list, parent, false));
        return holder;
    }

    static class ViewHolder extends BaseViewHolder {

        @BindView(R.id.image_head)
        ImageView image;
        @BindView(R.id.name)
        TextView name;
        @BindView(R.id.time)
        TextView time;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }

    }

}
